//
//  UserRealNameController.m
//  CheekiOS
//
//  Created by mac on 2017/6/20.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "UserRealNameController.h"

#import "UserRealNameFillController.h"
@interface UserRealNameController ()
@property (nonatomic, strong)HRSDUserInfo *infoModel;
@property (nonatomic, strong)UIButton *btn;
@end

@implementation UserRealNameController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNavgationBarHiddenNo];
    [self selfTitleFontColor];
    self.title = @"实名认证";
    
    UIImageView *imgView = [[UIImageView alloc] init];
    imgView.image = [UIImage imageNamed:@"p_center_smrz_ch_button"];
    imgView.contentMode = UIViewContentModeScaleAspectFill;
    imgView.frame = CGRectMake(KScreenWidth/2-KScreenWidth/4, 60, KScreenWidth/2, KScreenWidth/2);
    [self.view addSubview:imgView];
    
    UILabel *onelab = [[UILabel alloc] initWithFrame:CGRectMake(0, imgView.bottom+59, KScreenWidth, 30)];
    onelab.text = @"根据相关法律，开直播需要实名认证";
    onelab.font = FontP(17);
    onelab.textColor = [UIColor blackColor];
    onelab.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:onelab];
    
    UILabel *twolab = [[UILabel alloc] initWithFrame:CGRectMake(0, onelab.bottom, KScreenWidth, 30)];
    twolab.text = @"实名认证不涉及金钱账户";
    twolab.font = FontP(17);
    twolab.textColor = [UIColor blackColor];
    twolab.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:twolab];
    
    
    UILabel *threelab = [[UILabel alloc] initWithFrame:CGRectMake(0, twolab.bottom, KScreenWidth, 30)];
    threelab.text = @"认证信息贴脸儿会严格保密";
    threelab.font = FontP(17);
    threelab.textColor = [UIColor blackColor];
    threelab.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:threelab];
    
    
    _btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_btn addTarget:self action:@selector(didClickReal:) forControlEvents:UIControlEventTouchUpInside];
    [_btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    _btn.frame = CGRectMake(24, threelab.bottom+59, KScreenWidth-48, 50);
    _btn.backgroundColor = Colorbackground;
    _btn.layer.cornerRadius=25;
    
    [self.view addSubview:_btn];
    [self requestDate];

}

-(void)requestDate{
    
    [HQHttpManager sInfoWithUid:[HQHttpManager getUserId] myId:[HQHttpManager getUserId]
                   successBlock:^(BOOL isSuccess, NSDictionary *resultDic) {
                       
                       _infoModel = [HRSDUserInfo getSDUserInfoWithDictionary:resultDic];
                       
                       if ([_infoModel.cardImgStatus isEqualToString:@"1"]) {
                           [_btn setTitle:@"已认证" forState:UIControlStateNormal];
                           _btn.enabled = NO;
                       }else if([_infoModel.cardImgStatus isEqualToString:@"2"]){
                           [_btn setTitle:@"审核中" forState:UIControlStateNormal];
                           _btn.enabled = NO;
                       }else{
                           [_btn setTitle:@"点击认证" forState:UIControlStateNormal];
                       }
                   }];
    
}

- (void)didClickReal:(UIButton *)sender{
    NSLog(@"点击认证");
    UserRealNameFillController *CardVc = [[UserRealNameFillController alloc] init];
    [self.navigationController pushViewController:CardVc animated:YES];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
